# -*- conding:UTF-8 -*-

'''
@ Project: P7_lx1
@ File: tasks.py
@ Author: 罗婷
@ Date：2022/6/8 19:11
异步任务
'''
import json

from ronglian_sms_sdk import SmsSDK

from common.celery.celery_main import app

accId = '8a216da8804ba8a5018064a39933069b'
accToken = '09880a5e3fc94046b3cc147e240ad169'
appId = '8a216da8804ba8a5018064a39a3706a2'

@app.task
def sendSmsCode(mobile1, smsCode, expire=60):

    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'
    mobile = mobile1
    datas = (f'{smsCode}', f'{expire}')

    res = sdk.sendMessage(tid, mobile, datas)
    print('res======>?', res)
    # return res
    if res:
        return True
    else:
        return False
    # if json.loads(res)['status Code'] == "000000":
    # if res:
    #     return True
    # else:
    #     return False









